package jsu.blogger.pojo;

import lombok.Data;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

@Data
public class Draft {
    private String draftId;       // 草稿ID
    private Long userId;          // 用户ID
    private Long postId;          // 文章ID
    private String title;         // 标题
    private String content;       // 内容
    private  String coverOption = "single";//默认单图
    private String articleType="original";   // 文章类型 默认原创
    private String description="";//文章描述
    private String originalUrl;   // 原文链接
    private LocalDateTime updatedAt; // 更新时间
    private List<String> tags= new ArrayList<>();  // 标签列表
    // 有参构造方法
    public Draft(String draftId, Long userId, Long postId, String title, String content,
                 String coverOption,
                 String articleType, String originalUrl,String description, LocalDateTime updatedAt, List<String> tags) {
        this.draftId = draftId;
        this.userId = userId;
        this.postId = postId;
        this.description=description;
        this.title = title;
        this.content = content;
        this.coverOption=coverOption;
        this.articleType = articleType;
        this.originalUrl = originalUrl;
        this.updatedAt = updatedAt;
        this.tags = tags != null ? tags : new ArrayList<>();  // 确保标签列表不为null
    }

    // 默认构造方法
    public Draft() {
        // 可以设置默认值，或者让它为空
    }

    @Override
    public String toString() {
        return "Draft{" +
                "draftId='" + draftId + '\'' +
                ", userId=" + userId +
                ", postId=" + postId +
                ", title='" + title + '\'' +
                ", content='" + content + '\'' +
                ", coverOption='" + coverOption + '\'' +
                ", articleType='" + articleType + '\'' +
                ", description='" + description + '\'' +
                ", originalUrl='" + originalUrl + '\'' +
                ", updatedAt=" + updatedAt +
                ", tags=" + tags +
                '}';
    }
}
